{extend name="public/base"/}
{block name="style"}
{/block}
{block name="content"}
<div class="data-list" data-url="{:url('take')}">
    <form class="layui-form">
        <input type="hidden" name="check_id" value="{$check.check_id}">
        <input type="hidden" name="warehouse_id" value="{$check.warehouse.warehouse_id}">
        <input type="hidden" name="page_size" value="{$page_size}">
        <button class="layui-btn layui-hide layui-btn-sm layui-btn-normal search"><i class="layui-icon layui-icon-search"></i></button>
        <div class="info-header">
            <div class="layui-row">
                <div class="layui-col-xs3">
                    <label class="layui-form-label">盘点单号</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$check.check_sn}" readonly class="layui-input copy-text">
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <label class="layui-form-label">审批状态</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$check.check_status}" readonly class="layui-input">
                    </div>
                </div>
                <div class="layui-col-sm3">
                    <label class="layui-form-label">盘点状态</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$check.status?'已盘点':'待盘点'}" readonly class="layui-input">
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <input type="text" value="{$check.remark}" readonly class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs6">
                    <label class="layui-form-label">搜索SKU</label>
                    <div class="layui-input-block">
                        <input type="text" name="sku" placeholder="请输入需要搜索的SKU，多个使用逗号隔开" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-xs2">
                    <button type="button" class="layui-btn layui-bg-blue search"><i class="layui-icon layui-icon-search"></i></button>
                </div>
            </div>
        </div>
    </form>
    <form class="layui-form" action="{:url('take_save')}" id="wms-check-form" method="post">
        <input type="hidden" name="check_id" value="{$check.check_id}">
        <input type="hidden" name="warehouse_id" value="{$check.warehouse.warehouse_id}">
        <div class="layui-form-item">
             <button style="float: right;" type="button" id="wms-check-btn" class="layui-btn layui-btn-normal">盘点</button>
        </div>
        <div class="data">
            <p><i class="fa fa-spinner fa-spin"></i> 加载中...</p>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['jquery', 'layer'], function()
    {
        var $ = layui.$
            , layer = layui.layer;
        $("#wms-check-btn").click(function()
        {
            var $form = $("#wms-check-form");
            layer.load(0, {shade: false});
            $.post($form.attr('action'), $form.serialize()).done(function(response)
            {
                layer.closeAll('loading');
                var icon = response.code == 1 ? 6 : 5;
                layer.msg(response.msg, {icon: icon, time: 1500});
            });
        });
    });
</script>
{/block}